
#include "Socket.h"

# include <cstring>
# include <iostream>

# define PORT 4224
# define BUF_SIZE 42

void server()
{
    char buffer[BUF_SIZE];
    Socket server;
    Socket client;
    bool loop(true);

    server.open(AF_INET, SOCK_STREAM);
    server.bind(PORT, NULL);    
    server.listen(5);

    server.accept(&client);

    std::cout << "SERVER start" << std::endl;
    while (loop)
    {
        memset(buffer, 0, BUF_SIZE);

        client.recv(buffer, BUF_SIZE);
        std::cout << "recv : " <<  buffer << std::endl; 
	/*
        std::cin >> buffer;
        client.send(buffer, BUF_SIZE);
	*/
    }

    client.close();
    server.close();
}
